#include "logHelperJ.h"

LogHelperJ::LogHelperJ()
{

}

void LogHelperJ::write(QString text){

    QString outdir = "./Log";
    QDir dir;
    if (!dir.exists(outdir)) {
        dir.mkpath(outdir); // 创建目录
    }

    QString date= QDateTime::currentDateTime().toString("yyyyMMdd");
    QString outpath = outdir + "/qpcrmulti-log-" + date + ".txt";

    QFile file(outpath);
    file.open(QIODevice::Append);
    QString currentTime = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss");
    file.write((currentTime + "   " + text + "\n").toUtf8());
    qDebug() << (currentTime + "   " + text + "\n").toUtf8();
    file.close();

    return;
}
